import { ref, computed } from 'vue'
import { defineStore } from 'pinia'


export const useCounterStore = defineStore('counter', () => {
  const userId = ref('');
  const userName = ref('');
  const userpass = ref('');
  const searchHistory = ref([]);
  // 清空用户ID
  function clearId(){
    userId.value = '';
  };
  // 清空搜索记录
  function clearSearch(){
    searchHistory.value.splice(0);
  };

  return { userId,userName,userpass,searchHistory, clearId,clearSearch}
},

{
  persist: true
}
)
